<template>
  <div class="container">
    <!--顶部全局组件-->
    <HospitalTop @getValue="getSonValue"/>  
    <!-- 展示路由组件的区域 -->
    <div class="content">
      <!-- 展示路由组件的区域 -->
       <el-config-provider :locale="locale">
           <router-view></router-view>
       </el-config-provider>
    </div>
    <HosiptalBottom />
    <!-- 登录组件 -->
    <Login v-if="userStore.visiable" />
  </div>

</template>

<script setup lang="ts">
//引入用户仓库
import useUserStore from "@/store/modules/user";
let userStore = useUserStore();
// ******************************
import {getCurrentInstance,computed,ref ,watch} from 'vue';
import zhCn from 'element-plus/dist/locale/zh-cn.mjs';
import en from 'element-plus/dist/locale/en.mjs';

// ?表示前面如果返回null,后面不执行
let $this=getCurrentInstance()?.appContext.config.globalProperties as any
let language=ref<string>( $this.$i18n.locale)
// console.log(language);

const locale = computed(() => (language.value === 'zh-cn' ? zhCn : en))
const getSonValue = (value: string) => {
 language.value=value 
 console.log(language);
}

 


</script>

<style scoped lang="scss">
.container {
  display: flex;
  flex-direction: column;
  align-items: center;
  .content {
    margin-top: 70px;
    width: 1200px;
    min-height: 700px;
  }
}
</style>













































































































































